<?php
include_once($_SERVER['DOCUMENT_ROOT']."/php_functions/nbbc_parser/nbbc.php");
$bbcode = new BBCode;
$bbcode->SetAllowAmpersand(true);
$bbcode->SetSmileyURL("/images/emoticons");
$bbcode->SetPreTrim('a');	$bbcode->SetPostTrim('a');
$bbcode->SetURLTarget('_blank');
if(isset($text_limit)) {
	$bbcode->SetLimit($text_limit);
	//$bbcode->SetLimitTail('... <a href="lees verder">Lees verder</a>');
}

if(isset($inline)) {
	$bbcode_inline = new BBCode;
	$bbcode_inline->SetAllowAmpersand(true);
	$bbcode_inline->SetSmileyURL("/images/style".(isset($style_nmr) ? $style_nmr : "")."/emoticons");
	$bbcode_inline->SetPreTrim('a');	$bbcode->SetPostTrim('a');
	$bbcode_inline->SetURLTarget('_blank');
	$bbcode_inline->SetPlainMode(true);
	//$bbcode_inline->SetRootInline(true);
	//$bbcode_inline->SetIgnoreNewlines(true);
	if(isset($text_limit)) {
		$bbcode_inline->SetLimit($text_limit);
		//$bbcode->SetLimitTail('... <a href="lees verder">Lees verder</a>');
	}
}

/*spoiler rule*/
/*
$new_rule = Array(
	'simple_start' => '<div class=\'spoiler_trigger\'>[+]</div><div class=\'spoiler\'>',
	'simple_end' => '</div>',
	'class' => 'block',
	'allow_in' => Array('listitem', 'block', 'columns', 'inline')
);
$bbcode->AddRule('spoiler', $new_rule);
*/
/* Javascript die nodig is voor de spoiler */
/*
<script type='text/javascript'>
$(document).ready(function() {
	//Toggle spoiler
	$('.spoiler_trigger').click(function() {
		$(this).next('.spoiler').toggle();
	});
});
</script>
*/


/* player link rule */
/*
$bbcode->AddRule('player',  Array(
	'mode' => BBCODE_MODE_CALLBACK,
	'method' => 'find_player',
	'class' => 'block',
	'allow_in' => Array('listitem', 'block', 'inline', 'columns'),
));
function find_player($bbcode, $action, $name,
			$default, $params, $content) {
	if($action == BBCODE_CHECK) {
		if (isset($params['id'])
					&& !preg_match('/^[1-9][0-9]*$/', $params['id'])) {
			return false;
		}else {
			return true;
		}
	}else {
		$result = mysql_query("SELECT * FROM Speler WHERE CONCAT_WS(' ', voornaam, tussenvoegsel, achternaam) LIKE '".$content."'");
		if($result <> null && mysql_num_rows($result) > 0) {
			$row = mysql_fetch_object($result);
			return "<a href='/localhost/players/?id=".$row->spelerId."' target='_parent'>".$content."</a>";
		}else {
			return $content;
		}
	}
}
*/
?>